<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.2" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="javascript,require，sea," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.2" />






<meta name="description" content="为什么要用require.js?最早的时候，所有Javascript代码都写在一个文件里面，只要加载这一个文件就够了。后来，代码越来越多，一个文件不够了，必须分成多个文件，依次加载。下面的网页代码，相信很多人都见过。 123456&amp;lt;script src=&quot;1.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;script src=&quot;2.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;s">
<meta name="keywords" content="javascript,require，sea">
<meta property="og:type" content="article">
<meta property="og:title" content="Javascript模块化编程require.js的用法和sea.js">
<meta property="og:url" content="http://yoursite.com/2017/09/20/require.js的使用方法和sea.js/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:description" content="为什么要用require.js?最早的时候，所有Javascript代码都写在一个文件里面，只要加载这一个文件就够了。后来，代码越来越多，一个文件不够了，必须分成多个文件，依次加载。下面的网页代码，相信很多人都见过。 123456&amp;lt;script src=&quot;1.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;script src=&quot;2.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;s">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2017-09-20T06:54:36.443Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Javascript模块化编程require.js的用法和sea.js">
<meta name="twitter:description" content="为什么要用require.js?最早的时候，所有Javascript代码都写在一个文件里面，只要加载这一个文件就够了。后来，代码越来越多，一个文件不够了，必须分成多个文件，依次加载。下面的网页代码，相信很多人都见过。 123456&amp;lt;script src=&quot;1.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;script src=&quot;2.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;s">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '5.1.2',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2017/09/20/require.js的使用方法和sea.js/"/>





  <title>Javascript模块化编程require.js的用法和sea.js | Hexo</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Hexo</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/09/20/require.js的使用方法和sea.js/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="shine-wl">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="http://dynamic-image.yesky.com/300x-/uploadImages/upload/20140912/upload/201409/wylnwjynkxijpg.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Hexo">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Javascript模块化编程require.js的用法和sea.js</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-09-20T14:52:18+08:00">
                2017-09-20
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="为什么要用require-js"><a href="#为什么要用require-js" class="headerlink" title="为什么要用require.js?"></a>为什么要用require.js?</h1><p>最早的时候，所有Javascript代码都写在一个文件里面，只要加载这一个文件就够了。后来，代码越来越多，一个文件不够了，必须分成多个文件，依次加载。下面的网页代码，相信很多人都见过。</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">&lt;script src=<span class="string">"1.js"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span></div><div class="line">&lt;script src=<span class="string">"2.js"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span></div><div class="line">&lt;script src=<span class="string">"3.js"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span></div><div class="line">&lt;script src=<span class="string">"4.js"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span></div><div class="line">&lt;script src=<span class="string">"5.js"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span></div><div class="line">&lt;script src=<span class="string">"6.js"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span></div></pre></td></tr></table></figure>
<p>这段代码依次加载多个js文件。</p>
<p>这样的写法有很大的缺点。首先，加载的时候，浏览器会停止网页渲染，加载文件越多，网页失去响应的时间就会越长；其次，由于js文件之间存在依赖关系，因此必须严格保证加载顺序（比如上例的1.js要在2.js的前面），依赖性最大的模块一定要放到最后加载，当依赖关系很复杂的时候，代码的编写和维护都会变得困难。</p>
<p>require.js的诞生，就是为了解决这两个问题</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">（<span class="number">1</span>）实现js文件的异步加载，避免网页失去响应；</div><div class="line">（<span class="number">2</span>）管理模块之间的依赖性，便于代码的编写和维护。</div></pre></td></tr></table></figure>
<a id="more"></a>
<h1 id="require-js的加载"><a href="#require-js的加载" class="headerlink" title="require.js的加载"></a>require.js的加载</h1><p>使用require.js的第一步，是先去官方网站<a href="http://requirejs.org/docs/download.html" target="_blank" rel="external">下载</a>最新版本。下载后，假定把它放在js子目录下面，就可以加载了。</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">&lt;script src=<span class="string">"js/require.js"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span></div></pre></td></tr></table></figure>
<p>有人可能会想到，加载这个文件，也可能造成网页失去响应。解决办法有两个，一个是把它放在网页底部加载，另一个是写成下面这样：</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">&lt;script src=<span class="string">"js/require.js"</span> defer <span class="keyword">async</span>=<span class="string">"true"</span> &gt;<span class="xml"><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span></div><div class="line"><span class="comment">// async属性表明这个文件需要异步加载，避免网页失去响应。</span></div><div class="line"><span class="comment">// IE不支持这个属性，只支持defer，所以把defer也写上。</span></div></pre></td></tr></table></figure>
<p>加载require.js以后，下一步就要加载我们自己的代码了。假定我们自己的代码文件是main.js，也放在js目录下面。那么代码可以写成下面两种形式</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line"><span class="comment">// 第一种</span></div><div class="line">&lt;script src=<span class="string">"js/require.js"</span> data-main=<span class="string">"js/main"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span></div><div class="line"><span class="comment">// 第二种</span></div><div class="line">&lt;script src=<span class="string">"require.js"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span></div><div class="line">&lt;script&gt;</div><div class="line">	<span class="built_in">require</span>([<span class="string">'js/main'</span>],<span class="function"><span class="keyword">function</span>(<span class="params">main</span>)</span>&#123;</div><div class="line">      </div><div class="line">    &#125;);</div><div class="line">&lt;<span class="regexp">/script&gt;</span></div></pre></td></tr></table></figure>
<p>data-main属性的作用是，指定网页程序的主模块。在上例中，就是js目录下面的main.js，这个文件会第一个被require.js加载。由于require.js默认的文件后缀名是js，所以可以把main.js简写成main。</p>
<h1 id="主模块的写法"><a href="#主模块的写法" class="headerlink" title="主模块的写法"></a>主模块的写法</h1><p>上一节的main.js，我把它称为”主模块”，意思是整个网页的入口代码，所有代码都从这儿开始运行</p>
<p>如果我们的代码不依赖任何其他模块，那么可以直接写入javascript代码。</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line"><span class="comment">// main.js</span></div><div class="line">consloe.log(<span class="string">'123'</span>);</div></pre></td></tr></table></figure>
<p>但这样的话，就没必要使用require.js了。常见的情况是，主模块依赖于其他模块，这时就要使用AMD规范定义的的require()函数。</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line"><span class="comment">// main.js</span></div><div class="line"><span class="built_in">require</span>([<span class="string">'moduleA'</span>, <span class="string">'moduleB'</span>, <span class="string">'moduleC'</span>], <span class="function"><span class="keyword">function</span> (<span class="params">moduleA, moduleB, moduleC</span>)</span>&#123;</div><div class="line">　　<span class="comment">// some code here</span></div><div class="line">&#125;);</div></pre></td></tr></table></figure>
<p>require()函数接受两个参数。</p>
<p>第一个参数是一个数组，表示所依赖的模块，上例就是[‘moduleA’, ‘moduleB’, ‘moduleC’]，即主模块依赖这三个模块；</p>
<p>第二个参数是一个回调函数，当前面指定的模块都加载成功后，它将被调用。加载的模块会以参数形式传入该函数，从而在回调函数内部就可以使用这些模块，回到函数中的参数就是第一个参数中对应模块所返回的数据</p>
<p>require()异步加载moduleA，moduleB和moduleC，浏览器不会失去响应；它指定的回调函数，只有前面的模块都加载成功后，才会运行，解决了依赖性的问题。</p>
<p>假定主模块依赖jquery、underscore和backbone这三个模块，main.js就可以这样写：</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">require</span>([<span class="string">'jquery'</span>, <span class="string">'underscore'</span>, <span class="string">'backbone'</span>], <span class="function"><span class="keyword">function</span> (<span class="params">$, _, Backbone</span>)</span>&#123;</div><div class="line">  <span class="comment">//$就是jquery中所返回的数据</span></div><div class="line">  <span class="comment">//_就是underscore中所返回的数据</span></div><div class="line">  <span class="comment">//Backbone就是backbone中所返回的数据</span></div><div class="line">　　<span class="comment">// some code here</span></div><div class="line">&#125;);</div></pre></td></tr></table></figure>
<p>require.js会先加载jQuery、underscore和backbone，然后再运行回调函数。主模块的代码就写在回调函数中。</p>
<h1 id="模块的加载"><a href="#模块的加载" class="headerlink" title="模块的加载"></a>模块的加载</h1><p>主模块的依赖模块是[‘jquery’, ‘underscore’, ‘backbone’]。默认情况下，require.js假定这三个模块与main.js在同一个目录，文件名分别为jquery.js，underscore.js和backbone.js，然后自动加载。</p>
<p>使用require.config()方法，我们可以对模块的加载行为进行自定义。require.config()就写在主模块（main.js）的头部。参数就是一个对象，这个对象的paths属性指定各个模块的加载路径。</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">require</span>.config(&#123;</div><div class="line">　　paths: &#123;</div><div class="line">　　　　<span class="string">"jquery"</span>: <span class="string">"jquery.min"</span>, <span class="comment">// 路径,默认和main.js同一个路径</span></div><div class="line">　　　　<span class="string">"underscore"</span>: <span class="string">"underscore.min"</span>,</div><div class="line">　　　　<span class="string">"backbone"</span>: <span class="string">"backbone.min"</span></div><div class="line">　　&#125;</div><div class="line">&#125;);</div></pre></td></tr></table></figure>
<p>上面的代码给出了三个模块的文件名，路径默认与main.js在同一个目录（js子目录）。如果这些模块在其他目录，比如js/lib目录，则有两种写法。一种是逐一指定路径。</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">require</span>.config(&#123;</div><div class="line">　　paths: &#123;</div><div class="line">　　　　<span class="string">"jquery"</span>: <span class="string">"lib/jquery.min"</span>, <span class="comment">// main依赖这些文件则执行的时候直接在lib里找</span></div><div class="line">　　　　<span class="string">"underscore"</span>: <span class="string">"lib/underscore.min"</span>,</div><div class="line">　　　　<span class="string">"backbone"</span>: <span class="string">"lib/backbone.min"</span></div><div class="line">　　&#125;</div><div class="line">&#125;);</div></pre></td></tr></table></figure>
<p>另一种则是直接改变基目录（baseUrl）。</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">require</span>.config(&#123;</div><div class="line">　　baseUrl: <span class="string">"js/lib"</span>,</div><div class="line">　　paths: &#123;</div><div class="line">　　　　<span class="string">"jquery"</span>: <span class="string">"jquery.min"</span>,</div><div class="line">　　　　<span class="string">"underscore"</span>: <span class="string">"underscore.min"</span>,</div><div class="line">　　　　<span class="string">"backbone"</span>: <span class="string">"backbone.min"</span></div><div class="line">　　&#125;</div><div class="line">&#125;);</div></pre></td></tr></table></figure>
<p>如果某个模块在另一台主机上，也可以直接指定它的网址，比如：</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">require</span>.config(&#123;</div><div class="line">　　paths: &#123;</div><div class="line">　　　　<span class="string">"jquery"</span>: <span class="string">"https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min"</span></div><div class="line">　　&#125;</div><div class="line">&#125;);</div></pre></td></tr></table></figure>
<p>require.js要求，每个模块是一个单独的js文件。这样的话，如果加载多个模块，就会发出多次HTTP请求，会影响网页的加载速度。因此，require.js提供了一个<a href="http://requirejs.org/docs/optimization.html" target="_blank" rel="external">优化工具</a>，当模块部署完毕以后，可以用这个工具将多个模块合并在一个文件中，减少HTTP请求数。</p>
<h1 id="AMD模块的写法"><a href="#AMD模块的写法" class="headerlink" title="AMD模块的写法"></a>AMD模块的写法</h1><p>require.js加载的模块，采用AMD规范。也就是说，模块必须按照AMD的规定来写。</p>
<p>具体来说，就是模块必须采用特定的define()函数来定义。如果一个模块不依赖其他模块，那么可以直接定义在define()函数之中。</p>
<p>假定现在有一个index.js文件，它定义了一个index模块。那么，index.js就要这样写：</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line"><span class="comment">// index.js</span></div><div class="line">define(<span class="function"><span class="keyword">function</span> (<span class="params"></span>)</span>&#123;</div><div class="line">　　<span class="keyword">var</span> add = <span class="function"><span class="keyword">function</span> (<span class="params">x,y</span>)</span>&#123;</div><div class="line">　　　　<span class="keyword">return</span> x+y;</div><div class="line">　　&#125;;</div><div class="line">　　<span class="keyword">return</span> &#123;</div><div class="line">　　　　add: add</div><div class="line">　　&#125;;</div><div class="line">&#125;);</div></pre></td></tr></table></figure>
<p>加载方法如下：</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line"><span class="comment">// main.js</span></div><div class="line"><span class="built_in">require</span>([<span class="string">'index'</span>], <span class="function"><span class="keyword">function</span> (<span class="params">math</span>)</span>&#123;</div><div class="line">　　alert(math.add(<span class="number">1</span>,<span class="number">1</span>));</div><div class="line">&#125;);</div></pre></td></tr></table></figure>
<p>如果这个模块还依赖其他模块，那么define()函数的第一个参数，必须是一个数组，指明该模块的依赖性。</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line"><span class="comment">// index.js</span></div><div class="line">define([<span class="string">'myLib'</span>], <span class="function"><span class="keyword">function</span>(<span class="params">myLib</span>)</span>&#123;</div><div class="line">　　<span class="function"><span class="keyword">function</span> <span class="title">foo</span>(<span class="params"></span>)</span>&#123;</div><div class="line">　　　　myLib.doSomething();</div><div class="line">　　&#125;</div><div class="line">　　<span class="keyword">return</span> &#123;</div><div class="line">　　　　foo : foo</div><div class="line">　　&#125;;</div><div class="line">&#125;);</div></pre></td></tr></table></figure>
<p>当require()函数加载上面这个模块的时候，就会先加载myLib.js文件。</p>
<h1 id="加载非规范的模块"><a href="#加载非规范的模块" class="headerlink" title="加载非规范的模块"></a>加载非规范的模块</h1><p>理论上，require.js加载的模块，必须是按照AMD规范、用define()函数定义的模块。但是实际上，虽然已经有一部分流行的函数库（比如jQuery）符合AMD规范，更多的库并不符合。那么，require.js是否能够加载非规范的模块呢？</p>
<p>回答是可以的。</p>
<p>这样的模块在用require()加载之前，要先用require.config()方法，定义它们的一些特征。</p>
<p>举例来说，underscore和backbone这两个库，都没有采用AMD规范编写。如果要加载它们的话，必须先定义它们的特征。</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">require</span>.config(&#123;</div><div class="line">　　shim: &#123;</div><div class="line">		<span class="string">'underscore'</span>:&#123;</div><div class="line">　　　　　　　exports: <span class="string">'_'</span></div><div class="line">　　　　 &#125;,</div><div class="line">　　　　 <span class="string">'backbone'</span>: &#123;</div><div class="line">　　　　　　　deps: [<span class="string">'underscore'</span>, <span class="string">'jquery'</span>],</div><div class="line">　　　　　　　exports: <span class="string">'Backbone'</span></div><div class="line">　　　　　&#125;</div><div class="line">　　&#125;</div><div class="line">&#125;);</div></pre></td></tr></table></figure>
<p>require.config()接受一个配置对象，这个对象除了有前面说过的paths属性之外，还有一个shim属性，专门用来配置不兼容的模块。具体来说，每个模块要定义exports值（输出的变量名），表明这个模块外部调用时的名称；deps数组，表明该模块的依赖性。</p>
<p>比如，jQuery的插件jquery.scroll.js可以这样定义：</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">require</span>.config(&#123;</div><div class="line">　　shim: &#123;</div><div class="line">		<span class="string">'jquery.scroll'</span>: &#123;</div><div class="line">　　　　　　deps: [<span class="string">'jquery'</span>],</div><div class="line">　　　　　　exports: <span class="string">'jQuery.fn.scroll'</span></div><div class="line">　　　　&#125;</div><div class="line">　　&#125;</div><div class="line">&#125;);</div></pre></td></tr></table></figure>
<h1 id="require-js插件"><a href="#require-js插件" class="headerlink" title="require.js插件"></a>require.js插件</h1><p>domready插件，可以让回调函数在页面DOM结构加载完成后再运行。</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">require</span>([<span class="string">'domready!'</span>], <span class="function"><span class="keyword">function</span> (<span class="params">doc</span>)</span>&#123;</div><div class="line">　　<span class="comment">// called once the DOM is ready</span></div><div class="line">&#125;);</div></pre></td></tr></table></figure>
<p>text和image插件，则是允许require.js加载文本和图片文件。</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">define([</div><div class="line">　　<span class="string">'text!review.txt'</span>,</div><div class="line">　　<span class="string">'image!cat.jpg'</span></div><div class="line">　　],</div><div class="line">　　<span class="function"><span class="keyword">function</span>(<span class="params">review,cat</span>)</span>&#123;</div><div class="line">　　　　<span class="built_in">console</span>.log(review);</div><div class="line">　　　　<span class="built_in">document</span>.body.appendChild(cat);</div><div class="line">　　&#125;</div><div class="line">);</div></pre></td></tr></table></figure>
<h1 id="require-js实例"><a href="#require-js实例" class="headerlink" title="require.js实例"></a>require.js实例</h1><p><strong>看了下面的例子相信你就会明白了</strong></p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div></pre></td><td class="code"><pre><div class="line"><span class="meta">&lt;!DOCTYPE html&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">head</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">title</span>&gt;</span>Document<span class="tag">&lt;/<span class="name">title</span>&gt;</span></div><div class="line">  <span class="comment">&lt;!-- &lt;script data-main='main.js' src="require.js"&gt;&lt;/script&gt; --&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">script</span> <span class="attr">src</span>=<span class="string">"require.js"</span>&gt;</span><span class="undefined"></span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">script</span> <span class="attr">type</span>=<span class="string">"text/javascript"</span>&gt;</span><span class="undefined"></span></div><div class="line"><span class="javascript">    <span class="comment">// 动态创建script标签，通过该标签的src属性发出去的请求都是异步的（不阻塞的）</span></span></div><div class="line"><span class="javascript">    <span class="built_in">require</span>.config(&#123;</span></div><div class="line"><span class="javascript">      baseUrl : <span class="string">'/js'</span>, <span class="comment">// 设置查找模块的参考路径,所有的js文件都在js文件夹里</span></span></div><div class="line"><span class="javascript">      paths : &#123; <span class="comment">// 给模块起一个别名，方便依赖模块时使用</span></span></div><div class="line"><span class="javascript">        m1 : <span class="string">'module1'</span>,</span></div><div class="line"><span class="javascript">        m2 : <span class="string">'module2'</span>,</span></div><div class="line"><span class="javascript">        t : <span class="string">'test'</span>,</span></div><div class="line"><span class="javascript">        jquery : <span class="string">'jquery'</span></span></div><div class="line"><span class="undefined">      &#125;,</span></div><div class="line"><span class="javascript">      shim : &#123; <span class="comment">// 垫片 pollyfill 腻子脚本 作用：把非标准模块，变成标准模块</span></span></div><div class="line"><span class="undefined">        t : &#123;</span></div><div class="line"><span class="javascript">          exports : <span class="string">'foo'</span></span></div><div class="line"><span class="undefined">        &#125;</span></div><div class="line"><span class="undefined">      &#125;</span></div><div class="line"><span class="undefined">    &#125;);</span></div><div class="line"><span class="undefined"></span></div><div class="line"><span class="javascript">    <span class="comment">// 执行main.js文件</span></span></div><div class="line"><span class="javascript">    <span class="built_in">require</span>([<span class="string">'../main'</span>],<span class="function"><span class="keyword">function</span>(<span class="params">m</span>)</span>&#123;</span></div><div class="line"><span class="undefined">      m.fn();</span></div><div class="line"><span class="undefined">      m.foo();</span></div><div class="line"><span class="undefined">    &#125;);</span></div><div class="line"><span class="undefined">  </span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">head</span>&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">body</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">div</span> <span class="attr">id</span>=<span class="string">"test"</span>&gt;</span>Require.js<span class="tag">&lt;/<span class="name">div</span>&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">body</span>&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">html</span>&gt;</span></div></pre></td></tr></table></figure>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div></pre></td><td class="code"><pre><div class="line"><span class="comment">// main.js代码</span></div><div class="line">define([<span class="string">'m1'</span>,<span class="string">'m2'</span>,<span class="string">'t'</span>,<span class="string">'jquery'</span>],<span class="function"><span class="keyword">function</span>(<span class="params">m1,m2,t,$</span>)</span>&#123;</div><div class="line">  <span class="comment">// main.js依赖m1,m2,t,jquery四个js文件</span></div><div class="line">  $(<span class="string">'#test'</span>).css(<span class="string">'backgroundColor'</span>,<span class="string">'green'</span>);</div><div class="line">  <span class="comment">//执行module1中的方法并输出</span></div><div class="line">  <span class="comment">//m1=&#123;</span></div><div class="line">  <span class="comment">//  sum : sum,</span></div><div class="line">  <span class="comment">//  subtract : subtract</span></div><div class="line">  <span class="comment">//&#125;</span></div><div class="line">  <span class="built_in">console</span>.log(m1.sum(<span class="number">1</span>,<span class="number">2</span>)); <span class="comment">//3</span></div><div class="line">  <span class="built_in">console</span>.log(m1.subtract(<span class="number">1</span>,<span class="number">2</span>)); <span class="comment">//-1</span></div><div class="line">  </div><div class="line">  <span class="comment">//t</span></div><div class="line">  t();<span class="comment">//gannimeide</span></div><div class="line">  </div><div class="line">  <span class="keyword">var</span> fn = <span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</div><div class="line">    <span class="built_in">console</span>.log(<span class="string">'hello world'</span>);</div><div class="line">  &#125;</div><div class="line">  </div><div class="line">  <span class="keyword">var</span> obj = &#123;</div><div class="line">    fn : fn,</div><div class="line">    foo : <span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</div><div class="line">      <span class="built_in">console</span>.log(<span class="string">'foo'</span>);</div><div class="line">    &#125;</div><div class="line">  &#125;</div><div class="line">  <span class="keyword">return</span> obj;</div><div class="line">&#125;);</div></pre></td></tr></table></figure>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div></pre></td><td class="code"><pre><div class="line"><span class="comment">//module1</span></div><div class="line">define([<span class="string">'m2'</span>],<span class="function"><span class="keyword">function</span>(<span class="params">m2</span>)</span>&#123;</div><div class="line">  <span class="built_in">console</span>.log(m2.info);<span class="comment">//nihao</span></div><div class="line">  </div><div class="line">  <span class="keyword">var</span> sum = <span class="function"><span class="keyword">function</span>(<span class="params">a,b</span>)</span>&#123;</div><div class="line">    <span class="keyword">return</span> a + b;</div><div class="line">  &#125;;</div><div class="line"></div><div class="line">  <span class="keyword">var</span> subtract = <span class="function"><span class="keyword">function</span>(<span class="params">a,b</span>)</span>&#123;</div><div class="line">    <span class="keyword">return</span> a - b;</div><div class="line">  &#125;</div><div class="line"></div><div class="line">  <span class="keyword">return</span> &#123;</div><div class="line">    sum : sum,</div><div class="line">    subtract : subtract</div><div class="line">  &#125;</div><div class="line">&#125;);</div></pre></td></tr></table></figure>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line"><span class="comment">//module2</span></div><div class="line">define(<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</div><div class="line">  <span class="keyword">return</span> &#123;</div><div class="line">    info : <span class="string">'nihao'</span></div><div class="line">  &#125;</div><div class="line">&#125;);</div></pre></td></tr></table></figure>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line"><span class="comment">//test</span></div><div class="line"><span class="function"><span class="keyword">function</span> <span class="title">foo</span>(<span class="params"></span>) </span>&#123;</div><div class="line">  <span class="built_in">console</span>.log(<span class="string">'gannimeide'</span>)</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<p>jquery的引入就不举例子了跟上面的一样；</p>
<p>结语：就是哪个模块依赖谁就引入谁</p>
<h1 id="seajs"><a href="#seajs" class="headerlink" title="seajs"></a>seajs</h1><p>好处：使用seajs的好处 不用担心被引入js文件的依赖问题</p>
<ul>
<li>首先 引入文件</li>
</ul>
<p>引入文件  </p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">&lt;script src=&quot;js/sea.js&quot;&gt;&lt;/script&gt;</div></pre></td></tr></table></figure>
<p>启动模块 </p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">&lt;script&gt;seajs.use(&apos;./js/main.js&apos;)  &lt;/script&gt;</div></pre></td></tr></table></figure>
<ul>
<li>将程序的文件都划分成多个模块</li>
<li>seajs 专注于解决 JavaScript 模块</li>
<li>一个 JavaScript 文件就是一个模块</li>
<li>使用 seajs 可以通过 seajs.use(‘js的路径’) 去启动你的模块</li>
<li>然后每一个模块的js代码都写到 define 函数的回调函数中</li>
</ul>
<p><strong>define模板</strong></p>
<p>define(function (require, exports, module) {    <!--js代码-->})</p>
<ul>
<li>每一个模块都是私有作用域，完全封闭，默认只有在内部访问内部成员</li>
<li>外部无法访问模块内部成员，而模块也不会污染外部</li>
<li>seajs 专门为模块提供了固定的通信规则</li>
</ul>
<ul>
<li>define 函数的回调函数需要接收三个参数：(require, exports, module)</li>
</ul>
<p>require 是一个函数，作用：用于加载模块</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">require(&apos;路径&apos;) 返回值 return module.exports</div><div class="line"></div><div class="line">1. 加载并执行指定模块代码</div><div class="line">2. 得到模块的导出接口对象 module.exports3. 返回值是一个对象</div></pre></td></tr></table></figure>
<p>module 是一个对象，该对象中有一个成员叫做：exports ；默认模块最后会 return module.exports</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">exports 与 module.exports 关系</div><div class="line"></div><div class="line">exports === module.exports</div><div class="line"></div><div class="line">- 也就意味着修改 exports 也会影响 module.exports</div><div class="line">- 给 exports 重新赋值不管用，因为模块最终导出的是 module.exports</div><div class="line">- 所以如果你希望一个模块仅仅导出单一成员（而不是一个对象），则必须为 module.exports 重新赋值才可以</div></pre></td></tr></table></figure>
<p>综上所述，咱们在使用的是，只需要做到以下 4 点就可以了：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">- seajs.use() 启动模块系统</div><div class="line">- 把所有的模块都写到 define 函数中</div><div class="line">- 如果需要依赖项，则使用 require 进行加载</div><div class="line">- 如果需要进行模块接口导出，则手动往 module.exports 上挂载成员即可</div><div class="line">module.exports = function () &#123;console.log(&apos;hello foo&apos;)&#125;  //到处函数function</div></pre></td></tr></table></figure>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/javascript/" rel="tag"># javascript</a>
          
            <a href="/tags/require，sea/" rel="tag"># require，sea</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/09/20/cookie和sesson/" rel="next" title="cookie和session">
                <i class="fa fa-chevron-left"></i> cookie和session
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/09/20/Git使用/" rel="prev" title="git 基本使用">
                git 基本使用 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="http://dynamic-image.yesky.com/300x-/uploadImages/upload/20140912/upload/201409/wylnwjynkxijpg.jpg"
               alt="shine-wl" />
          <p class="site-author-name" itemprop="name">shine-wl</p>
           
              <p class="site-description motion-element" itemprop="description"></p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
            
              <a href="/archives/">
            
                <span class="site-state-item-count">21</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          

          
            
            
            <div class="site-state-item site-state-tags">
              
                <span class="site-state-item-count">15</span>
                <span class="site-state-item-name">标签</span>
              
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#为什么要用require-js"><span class="nav-number">1.</span> <span class="nav-text">为什么要用require.js?</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#require-js的加载"><span class="nav-number">2.</span> <span class="nav-text">require.js的加载</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#主模块的写法"><span class="nav-number">3.</span> <span class="nav-text">主模块的写法</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#模块的加载"><span class="nav-number">4.</span> <span class="nav-text">模块的加载</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#AMD模块的写法"><span class="nav-number">5.</span> <span class="nav-text">AMD模块的写法</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#加载非规范的模块"><span class="nav-number">6.</span> <span class="nav-text">加载非规范的模块</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#require-js插件"><span class="nav-number">7.</span> <span class="nav-text">require.js插件</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#require-js实例"><span class="nav-number">8.</span> <span class="nav-text">require.js实例</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#seajs"><span class="nav-number">9.</span> <span class="nav-text">seajs</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">shine-wl</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动</div>

  <span class="post-meta-divider">|</span>

  <div class="theme-info">主题 &mdash; <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a> v5.1.2</div>


        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.2"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.2"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.2"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.2"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.2"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.2"></script>



  


  




	





  





  








  





  

  

  

  

  

  

</body>
</html>
